<html>
<head><meta charset="utf-8"><title>CtorKind constructors · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/CtorKind.20constructors.html">CtorKind constructors</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214205397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/CtorKind%20constructors/near/214205397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/CtorKind.20constructors.html#214205397">(Oct 22 2020 at 15:40)</a>:</h4>
<p>Is there an explanation for the names of the constructors in CtorKind? Why are they so different from VariantData if they map 1-1? I don't understand why a tuple constructor would be called <code>Fn</code></p>



<a name="214205604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/CtorKind%20constructors/near/214205604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/CtorKind.20constructors.html#214205604">(Oct 22 2020 at 15:42)</a>:</h4>
<p>Why would a struct constructor be <code>Fictive</code> ??</p>



<a name="214243721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/CtorKind%20constructors/near/214243721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/CtorKind.20constructors.html#214243721">(Oct 22 2020 at 20:26)</a>:</h4>
<p>Tuple struct constructors are functions, and unit struct constructors are constants, it's pretty simple - <a href="https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md">https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md</a></p>



<a name="214244361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/CtorKind%20constructors/near/214244361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/CtorKind.20constructors.html#214244361">(Oct 22 2020 at 20:32)</a>:</h4>
<p><code>Fictive</code> exists because braced enum variants are reserved in value namespace, i.e. for <code>enum E { V { a: u8 } }</code> <code>E::V</code> is a valid value path from name resolution point of view, but such paths are then immediately rejected by a semantic check anywhere except for imports.<br>
This reservation long overstayed its welcome though, since you reminded me of it I'll try to remove it and see what the lang team things about it now 4 or 5 years later.</p>



<a name="214562995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/CtorKind%20constructors/near/214562995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/CtorKind.20constructors.html#214562995">(Oct 26 2020 at 11:45)</a>:</h4>
<p>oh huh i didn't realize tuple constructors were functions, I thought they got built like structs did</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>